﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="房产销冠, 房地产,卡考网络" />
    <meta name="description" content="上海卡考网络有限公司" />
    <title>房产销冠</title>
    <link rel="stylesheet" href="css/list.css" type="text/css" />
    <link rel="stylesheet" href="css/global.css" type="text/css" />
    <link href="bootstrap/iCheck-master/skins/minimal/Orange.css" rel="stylesheet" type="text/css" />
    <!--<script src="js/jquery-1.8.3.min.js"></script>-->
    <!--<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />-->
    <script src="http://dn-blqw.qbox.me/jq+bs+art.js" type="text/javascript"></script>
    <!--<script src="js/jquery.easydropdown.min.js"></script>-->
    <!--<script src="bootstrap/iCheck-master/icheck.js"></script>-->
    <!--<script src="bootstrap/js/bootstrap.min.js"></script>-->
    <!--<script src="js/checkbox.js"></script>-->
    <script src="js/common.js"></script>
    <script src="js/PageIndex.js"></script>
    <script src="http://dn-blqw.qbox.me/kk.js"></script>
</head>
<body style="background: #f1f1f1;">
    <div class="main01">
        <div class="content clearfix">
            <div class="headline02">
                <div class="line_left">抽奖配置</div>
                <div class="line_right">
                    <ul class="nav_line_right">
                        <li class="con"><a href="#">首页</a></li>
                        <li>/</li>
                        <li class="con"><a href="#">系统管理</a></li>
                        <li>/</li>
                        <li class="con"><a href="#" style="color: #60b12a;">抽奖配置</a></li>
                    </ul>
                </div>
            </div>
            <div class="bton">
                <div class="bton_left">
                    <!--<div class="bton_left_nav">
                        <select id="F_CateogryKid" class="selall sel100 fl" style="margin-right:11px;">
                            <option value="">商品类型</option>
                        </select>
                        <label class="lab112 fl">
                            <input type="checkbox" id="F_Stock" name="F_Stock" value="" />&nbsp;已售完
                        </label>
                        <div class="fl mr10 fs14">商品标题:</div>
                        <input type="text" class="selall sel100 fl" id="keyWord" name="keyWord" style="margin-right:11px;" />
                        <input type="button" value="搜索" class="sbtn fl" onclick="f_Seach()" />
                    </div>-->
                </div>
                <div class="bton_right">
                    <div class="bton_left_nav">
                        <a href="javascript:;" class="btn_add last noimg">修改</a>
                    </div>
                    <div class="bton_left_nav pageIn2">
                    </div>
                </div>
            </div>
        </div>
        <div style="min-height: 500px;">
            <div style="min-width: 800px; overflow: auto;">
                <table class="table01" id="table_data" style="width: 100%; max-height: 400px; table-layout: fixed; border-bottom: 1px #e6e6e6 solid;">
                    <thead>
                        <tr class="info_title">
                            <th style="width: 60px;">序号</th>
                            <th style="width: 100px" class="mid_line">角度</th>
                            <th style="width: 100px;" class="mid_line">商品编号</th>
                            <th style="width: 100px;" class="mid_line">奖品名称</th>
                            <th style="width: 100px;" class="mid_line">奖品库存</th>
                            <th style="width: 100px" class="mid_line">奖励积分</th>
                            <th style="width: 100px" class="mid_line">中奖概率</th>                            
                            <th style="width: 100px" class="mid_line">出奖周期</th>
                            <th style="width: 120px" class="mid_line">周期最大奖量</th>
                            <th style="width: 120px" class="mid_line">周期内出奖量</th>
                            <th class="mid_line">描述</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr class="info_cont" style="display: none" name="data">
                            <td>{F_Index}<input type="hidden" value="{ID}" /></td>
                            <td>
                                <span class="td_span1">{Angle}</span>
                                <span class="td_span2" style="display:none"><input type="text" value="{Angle}" class="sinput" maxlength="50" /></span>
                            </td>
                            <td>
                                <span class="td_span1">{Kid}</span>
                                <span class="td_span2" style="display:none"><input type="text" value="{Kid}" class="sinput" maxlength="50" /></span>
                            </td>
                            <td>
                                <span class="td_span1">{Name}</span>
                                <span class="td_span2" style="display:none"><input type="text" value="{Name}" class="sinput" maxlength="50" /></span>
                            </td>
                            <td>
                                <span class="td_span1">{Count}</span>
                                <span class="td_span2" style="display:none"><input type="text" value="{Count}" class="sinput" maxlength="50" /></span>
                            </td>
                            <td>
                                <span class="td_span1">{Point}</span>
                                <span class="td_span2" style="display:none"><input type="text" value="{Point}" class="sinput" maxlength="50" /></span>
                            </td>
                            <td>
                                <span class="td_span1">{Chance}</span>
                                <span class="td_span2" style="display:none"><input type="text" value="{Chance}" class="sinput" maxlength="50" /></span>
                            </td>                           
                            <td>
                                <span class="td_span1">{Rate}</span>
                                <span class="td_span2" style="display:none"><input type="text" value="{Rate}" class="sinput" maxlength="50" /></span>
                            </td>
                            <td>
                                <span class="td_span1">{MaxCount}</span>
                                <span class="td_span2" style="display:none"><input type="text" value="{MaxCount}" class="sinput" maxlength="50" /></span>
                            </td>
                            <td>
                                <span class="td_span1">{LuckCount}</span>
                                <span class="td_span2" style="display:none"><input type="text" value="{LuckCount}" class="sinput" maxlength="50" /></span>
                            </td>
                            <td>
                                <span class="td_span1">{Description}</span>
                                <span class="td_span2" style="display:none"><input type="text" value="{Description}" class="sinput" width="230" maxlength="50" /></span>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <!--放置分页 begin -->
            <table style="width: 100%; height: auto">
                <tr>
                    <td colspan="15">
                        <div class="pageIn"></div>
                    </td>
                </tr>
            </table>
            <!--放置分页 end -->
        </div>
    </div>
    <script type="text/javascript" src="js/list.js"></script>
    <script type="text/javascript">

        //提交保存
        function SubmitFrom() {
            var UrlParameter = "";
            //装载参数
            $("#table_data tr[name='data']").each(function () {
                var kid = $(this).find("td").eq(0).find("input").val();
                var productKid = $(this).find("td").eq(1).find("input").val();
                var name = $(this).find("td").eq(2).find("input").val();
                var count = $(this).find("td").eq(3).find("input").val();
                var point = $(this).find("td").eq(4).find("input").val();
                var chance = $(this).find("td").eq(5).find("input").val();
                var angle = $(this).find("td").eq(6).find("input").val();
                var rate = $(this).find("td").eq(7).find("input").val();
                var maxCount = $(this).find("td").eq(8).find("input").val();
                var luckCount = $(this).find("td").eq(9).find("input").val();
                var description = $(this).find("td").eq(10).find("input").val();

                if (UrlParameter == "") {
                    UrlParameter += kid + ";" + name + ";" + count + ";" + point + ";" + chance + ";" + angle + ";" + rate + ";" + maxCount + ";" + luckCount + ";" + description + ";" + productKid;
                }
                else {
                    UrlParameter += "|" + kid + ";" + name + ";" + count + ";" + point + ";" + chance + ";" + angle + ";" + rate + ";" + maxCount + ";" + luckCount + ";" + description + ";" + productKid;
                }
            });

            console.debug(UrlParameter);
            kk.api.post("/LuckProduct/Update", { data: UrlParameter }, function (result) {
                if (result) {
                    location = location;
                } else {
                    $kk.popup("保存失败！", "success", 1500);
                }
            });
        }

        function f_Back() {
            self.location = document.referrer;
        }

        function f_Seach() {
            f_GetData();
            //alert(url);
        }
        //获取商品详细
        function f_GetData() {
            var idx = 0;
            $kk.api.get("/LuckProduct/GetList", function (res) {
                kk.fillTable(".table01", res, function (data, name) {
                    if (name == "F_Index") {
                        idx++;
                        return idx;
                    }
                });
            });
        }

        $(function () {
            f_GetData();
        });


        var isTrue = false;
        $(".noimg").click(function () {
            if (isTrue) {
                $(".td_span2").hide();
                $(".td_span1").show();
                $(".noimg").html("修改保存");
                isTrue = false;
                SubmitFrom();

            }
            else {
                noimgfunc();
            }
        });

        function noimgfunc() {
            $(".td_span2").show();
            $(".td_span1").hide();
            $(".noimg").html("提交保存");
            isTrue = true;
        }
    </script>
</body>
</html>
